package com.lagou.sqlSession;

import com.lagou.pojo.Configuration;

import java.io.InputStream;

public class SqlSessionFactoryBuilder {
    private Configuration configuration;

    public SqlSessionFactoryBuilder() {
        this.configuration = new Configuration();
    }

    public SqlSessionFactory build(InputStream inputStream) throws Exception {
        XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder(configuration);
        Configuration configuration = xmlConfigBuilder.parseConfiguration(inputStream);
        SqlSessionFactory sqlSessionFactory = new DefaultSqlSessionFactory(configuration);
        return sqlSessionFactory;
    }
}
